package com.icinfo.cloud.provider.punish.fastcase.controller;

import com.icinfo.cloud.common.core.Validator.BaseGroup;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.common.documentoperate.dto.StageDocCommonHtmlRequest;
import com.icinfo.cloud.provider.punish.common.documentoperate.dto.StageDocCommonOperateSaveDto;
import com.icinfo.cloud.provider.punish.common.documentoperate.dto.StageDocCommonPreviewDto;
import com.icinfo.cloud.provider.punish.common.documentoperate.vo.DocumentCommonFormDataVo;
import com.icinfo.cloud.provider.punish.common.documentoperate.vo.DocumentCommonFormHtmlVo;
import com.icinfo.cloud.provider.punish.service.IDocCommonOperateService;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseTemporarySaveDto;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.tools.utils.MapUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 *
 * 描述：文书通用操作
 *
 * @author chenhan
 * @date 2022年12月15日22:46:12
 */
@RestController
@RequestMapping()
public class AppDocCommonOperateController {

    @Resource
    private IDocCommonOperateService docCommonOperateService;

    /**
     * 获取文书html公共方法
     * @param request
     * @return
     */
    @PostMapping("/punish/stagedoc/common/getDocBaseInfo")
    public Result<DocumentCommonFormHtmlVo> getDocBaseInfo(@RequestBody @Validated(BaseGroup.Query.class) StageDocCommonHtmlRequest request) {
        return docCommonOperateService.getDocBaseInfo(request);
    }
    /**
     * 获取文书数据公共方法
     * @param request
     * @return
     */
    @PostMapping("/punish/stagedoc/common/getDocFormData")
    public Result<DocumentCommonFormDataVo> getDocFormData(@RequestBody @Validated(BaseGroup.Query.class) StageDocCommonHtmlRequest request) {
        return docCommonOperateService.getDocFormData(request);
    }

    /**
     * 描述：保存文书信息通用接口
     * @param saveDto
     * @return
     */
    @PostMapping("/punish/stagedoc/common/saveDocInfo")
    public Result<Map<String, Object>> saveDocInfo(@RequestBody @Validated StageDocCommonOperateSaveDto saveDto) {
        return docCommonOperateService.saveDocInfo(saveDto);
    }


    /**
     * 预览文书接口
     *
     * @param: previewDto
     **/
    @PostMapping(value = "/punish/stagedoc/common/docPreview")
    public Result<Map<String, Object>> docPreview(@RequestBody StageDocCommonPreviewDto previewDto) {
        return docCommonOperateService.docPreview(previewDto);
    }

    /**
     * 文书暂存功能--通用
     * @param saveDto
     * @return
     */
    @RequestMapping("/punish/ucase/temporary/saveTemporary")
    public Result saveCaseReasonRecord(@RequestBody CaseTemporarySaveDto saveDto) {
        return docCommonOperateService.saveCaseReasonRecord(saveDto);
    }
}
